﻿// Shared process class, (c)2010 Knihovnik
// This file is licensed under GNU GPL license v2, see more at http://www.gnu.org/licenses/gpl-2.0.html
namespace vKapse.VirtualDesktop.Core
{

	#region Using

	using System;
	using System.Xml.Serialization;

	#endregion Using

	/// <summary>
	/// Class that represents shared process
	/// </summary>
	[Serializable]
	internal class SharedProcess
	{

		#region Members
		private string m_processName;
		#endregion 

		#region Constructor

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="processName">Name of the shared process</param>
		public SharedProcess(string processName)
		{
			this.m_processName = processName;
		}

		#endregion

		#region Properties

		/// <summary>
		/// Gets or sets name of the shared process
		/// </summary>
		[XmlAttribute]
		public string Name
		{
			set
			{
				this.m_processName = value;
			}
			get
			{
				return this.m_processName;
			}
		}

		#endregion

		#region Override Methods

		public override int GetHashCode()
		{
			return this.m_processName.GetHashCode();
		}

		public override bool Equals(object obj)
		{
			if (obj is string)
			{
				string value = obj.ToString();
				return (value == this.m_processName);
			}
			if (obj is SharedProcess)
			{
				return (((SharedProcess)obj).m_processName == this.m_processName);
			}
			return base.Equals(obj);
		}

		#endregion

	}
}
